package com.example.service;

import jodd.mail.Email;
import jodd.mail.MailServer;
import jodd.mail.SendMailSession;
import jodd.mail.SmtpServer;

public class Main {
    public static void main(String[] args) {
        SmtpServer smtpServer = MailServer.create()
                .ssl(true)
                .host("smtp.gmail.com")
                .auth("d847239863@gmail.com", "mail")
                .buildSmtpMailServer();

        Email email = Email.create()
                .from("d847239863@gmail.com")
                .to("dgfwork@163.com")
                .subject("hello")
                .textMessage("Hello world!");

        SendMailSession session = smtpServer.createSession();
        session.open();
        session.sendMail(email);
        //session.close();
    }

}
